﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MEFLauncher.MyControls
{
	/// <summary>
	/// SettingTabButton.xaml 的交互逻辑
	/// </summary>
	public partial class SettingTabButton : RadioButton
	{
		#region properties
		// 起始颜色。
		private static Color _fromColor =
			Color.FromArgb(80, 0, 0, 0);

		// 终止颜色。
		private static Color _toColor =
			Color.FromArgb(80, 255, 0, 0);

		// 持续时间。
		private static Duration _duration =
			new Duration(TimeSpan.FromSeconds(1));

		// 默认前景色。
		private static SolidColorBrush _foreground =
			new SolidColorBrush(_fromColor);

		// 用于数据绑定的前景色属性（只读）
		public SolidColorBrush ForegroundBrush => _foreground;

		private static ColorAnimation _colorAnim =
			new ColorAnimation(_fromColor, _toColor, _duration);

		#endregion

		#region content controls

		// 文本框
		private TextBlock _textblock =>
			Template.FindName("TB", this) as TextBlock;

		#endregion


		#region ctor
		public SettingTabButton()
		{
			InitializeComponent();
			this.DataContext = this;
			this.Click += SettingTabButton_Click;
			this.Checked += SettingTabButton_Checked;
			this.Unchecked += SettingTabButton_Unchecked;
		}


		#endregion

		#region events

		// 解除事件。
		private void SettingTabButton_Unchecked(object sender, RoutedEventArgs e)
		{
			//throw new NotImplementedException();
		}

		// 确认事件。
		private void SettingTabButton_Checked(object sender, RoutedEventArgs e)
		{
			//throw new NotImplementedException();
		}

		// 点击事件。
		private void SettingTabButton_Click(object sender, RoutedEventArgs e)
		{
			_foreground.BeginAnimation(SolidColorBrush.ColorProperty, _colorAnim);
		}
		#endregion
		
	}
}
